package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 工单操作记录
 * </p>
 *
 * @author linan
 * @date 2022-11-09
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "WorkOrderOperationRecordDisposalResultEnum", description = "处理结果 #{SETUP_COMPLETE:安装完毕;NO_INSTALLATION_REQUIRED:无需安装;TROUBLE_SHOOTING:故障维修;DAMAGE_REPAIR:损坏维修;FAILURE_REPLACEMENT:故障更换;REPLACE_IF_DAMAGED:损坏更换;ARTIFICIAL_DAMAGE:人为损坏（赔偿）;SITE_ACCEPTANCE_IS_QUALIFIED:场地验收合格;UNQUALIFIED_SITE_DAMAGE:场地损坏不合格;FINISH:完成-枚举")
public enum WorkOrderOperationRecordDisposalResultEnum implements BaseEnum {

    /**
     * SETUP_COMPLETE="安装完毕"
     */
    SETUP_COMPLETE("安装完毕"),
    /**
     * NO_INSTALLATION_REQUIRED="无需安装"
     */
    NO_INSTALLATION_REQUIRED("无需安装"),
    /**
     * TROUBLE_SHOOTING="故障维修"
     */
    TROUBLE_SHOOTING("故障维修"),
    /**
     * DAMAGE_REPAIR="损坏维修"
     */
    DAMAGE_REPAIR("损坏维修"),
    /**
     * FAILURE_REPLACEMENT="故障更换"
     */
    FAILURE_REPLACEMENT("故障更换"),
    /**
     * REPLACE_IF_DAMAGED="损坏更换"
     */
    REPLACE_IF_DAMAGED("损坏更换"),
    /**
     * ARTIFICIAL_DAMAGE="人为损坏（赔偿）"
     */
    ARTIFICIAL_DAMAGE("人为损坏（赔偿）"),
    /**
     * SITE_ACCEPTANCE_IS_QUALIFIED="场地验收合格"
     */
    SITE_ACCEPTANCE_IS_QUALIFIED("场地验收合格"),
    /**
     * UNQUALIFIED_SITE_DAMAGE="场地损坏不合格"
     */
    UNQUALIFIED_SITE_DAMAGE("场地损坏不合格"),
    /**
     * FINISH="完成"
     */
    FINISH("完成"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static WorkOrderOperationRecordDisposalResultEnum match(String val, WorkOrderOperationRecordDisposalResultEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static WorkOrderOperationRecordDisposalResultEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(WorkOrderOperationRecordDisposalResultEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SETUP_COMPLETE,NO_INSTALLATION_REQUIRED,TROUBLE_SHOOTING,DAMAGE_REPAIR,FAILURE_REPLACEMENT,REPLACE_IF_DAMAGED,ARTIFICIAL_DAMAGE,SITE_ACCEPTANCE_IS_QUALIFIED,UNQUALIFIED_SITE_DAMAGE,FINISH", example = "SETUP_COMPLETE")
    public String getCode() {
        return this.name();
    }

}
